
local ShopButton = MClass("ShopButton")
-- local get_battle_money = battle.Unit.getMoney
function ShopButton:updateMoney(money)
    self.num:setString(money)
end

function ShopButton:ctor()
    --self.root 默认为根节点
    --设置事件

    self.bg = self:findChild("Panel/bg")
    self.num = self:findChild("Panel/num")

    self.bg:setTouchEnabled(true)
    self:init()
end

function ShopButton:init()
    local function touchEvent_shop(sender, eventType)
        if eventType == ccui.TouchEventType.ended then
            BattleUIEvent:dispatchEvent(BattleUIEvent.TYPE.SHOW_BATTLE_SHOP,1)
        end
    end
    self.bg:addTouchEventListener(touchEvent_shop)
end

return ShopButton